from api.ihrmEmpManageApi import EmpManageApi
from common.DBT框架 import DBTools
from common.assertTools import common_assret
from common.getHeader import get_header


class TestQueryEmp(object):
    def setup_class(self): #开头调用一次
       self.emp = EmpManageApi() #创建实例
       self.req_header = get_header() #获取请求头
    def setup(self): #创建一个ID 查询
        DBTools.db_iud("insert into bs_user(id,mobile,username) values('1234324','13454323344','会飞的猪');")
    def teardowm(self): #最后删除清零内存
        DBTools.db_iud("delete from bs_user where id ='1234324';")
    def test01_query_success(self): #查询原员工 先建实例 调用添加接口 传参 打印 断言
        res=self.emp.query_emp('1234324',self.req_header)
        print("查询员工",res.json())
        common_assret(res,200,True,10000,"操作成功")

    def test02_id_no(self):
        res = self.emp.query_emp('1234', self.req_header)
        print("ID不存在",res.json())
        common_assret(res,200,False,20005,"查询员工失败")